﻿using System.Collections.Generic;
using System.ServiceModel;
using Domep.Server.BusinessObjects;
using Domep.Server.Contracts;
using Domep.Server.Services.Kernel.DBCommunication;

namespace Domep.Server.Services
{
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
    public class AppliancePresentationManager : IAppliancePresentationManager
    {
        #region IAppliancePresentationManager Members

        public List<AppliancePresentation> GetAppliancesList()
        {
            ApplianceRetriever retriever = new ApplianceRetriever();

            List<AppliancePresentation> appliancePresentations = new List<AppliancePresentation>();

            foreach (Appliance a in retriever.GetAppliances())
                appliancePresentations.Add(new AppliancePresentation(a));

            return appliancePresentations;
        }

        public List<FunctionalityPresentation> GetFunctionalities()
        {
            FunctionalityRetriever retriever = new FunctionalityRetriever();

            List<FunctionalityPresentation> functionalityPresentations = new List<FunctionalityPresentation>();

            foreach (Functionality f in retriever.GetFunctionalities())
                functionalityPresentations.Add(new FunctionalityPresentation(f));

            return functionalityPresentations;
        }

        public List<ApplianceModel> GetApplianceModels()
        {
            ApplianceModelRetriever retriever = new ApplianceModelRetriever();

            List<ApplianceModel> applianceModels = new List<ApplianceModel>();
            foreach (ApplianceModel am in retriever.GetApplianceModels())
                applianceModels.Add(am);
            return applianceModels;
        }

        #endregion

    }
}